<?php

namespace App\Admin\Controllers;

use App\Services\SwitchPortFlowService;
use Slowlyo\OwlAdmin\Controllers\AdminController;

/**
 * 端口流量详情
 *
 * @property SwitchPortFlowService $service
 */
class SwitchPortFlowController extends AdminController
{
	protected string $serviceName = SwitchPortFlowService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->bulkActions([])
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('day', 'Day'),
				amis()->TableColumn('in_collects', 'InCollects')->sortable(),
				amis()->TableColumn('in_rates', 'InRates'),
				amis()->TableColumn('month', 'Month'),
				amis()->TableColumn('out_collects', 'OutCollects')->sortable(),
				amis()->TableColumn('out_rates', 'OutRates'),
				amis()->TableColumn('switch_id', 'SwitchId'),
				amis()->TableColumn('switch_port_id', 'SwitchPortId'),
				amis()->TableColumn('timeline', 'Timeline')->sortable(),
				amis()->TableColumn('timeline_5min', 'Timeline5min')->sortable(),
				amis()->TableColumn('year', 'Year'),
			]);

		return $this->baseList($crud);
	}

	public function form($isEdit = false)
	{
		return $this->baseForm()->body([
			amis()->TextControl('day', 'Day'),
			amis()->TextControl('in_collects', 'InCollects'),
			amis()->TextControl('in_rates', 'InRates'),
			amis()->TextControl('month', 'Month'),
			amis()->TextControl('out_collects', 'OutCollects'),
			amis()->TextControl('out_rates', 'OutRates'),
			amis()->TextControl('switch_id', 'SwitchId'),
			amis()->TextControl('switch_port_id', 'SwitchPortId'),
			amis()->TextControl('timeline', 'Timeline'),
			amis()->TextControl('timeline_5min', 'Timeline5min'),
			amis()->TextControl('year', 'Year'),
		]);
	}

	public function detail()
	{
		return $this->baseDetail()->body([
			amis()->TextControl('id', 'ID')->static(),
			amis()->TextControl('day', 'Day')->static(),
			amis()->TextControl('in_collects', 'InCollects')->static(),
			amis()->TextControl('in_rates', 'InRates')->static(),
			amis()->TextControl('month', 'Month')->static(),
			amis()->TextControl('out_collects', 'OutCollects')->static(),
			amis()->TextControl('out_rates', 'OutRates')->static(),
			amis()->TextControl('switch_id', 'SwitchId')->static(),
			amis()->TextControl('switch_port_id', 'SwitchPortId')->static(),
			amis()->TextControl('timeline', 'Timeline')->static(),
			amis()->TextControl('timeline_5min', 'Timeline5min')->static(),
			amis()->TextControl('year', 'Year')->static(),
		]);
	}
}